﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.ComponentModel;

namespace System
{
    public static class ReflectionExtend
    {

        public static T GetAttribute<T>(this FieldInfo value) where T : Attribute
        {
            var attributes = (T[])value.GetCustomAttributes(typeof(T), false);
            if (attributes.Length > 0)
            {
                return attributes[0];
            }
            return null;
        } 
    }
}
